package com.topsmob;

import com.topsmob.piepline.JeeCmsPiePline;
import com.topsmob.processer.MyExceptionProcesser;

import us.codecraft.webmagic.Spider;
import us.codecraft.webmagic.monitor.SpiderMonitor;

import javax.management.JMException;
import java.security.Security;

/**
 * com.topsmob
 * Description:
 * User:李耀华
 * Date:2017-06-22.16:22
 */
public class StartApp {
    public static String siteUrl = "http://www.myexception.cn/";
    public static void main(String[] args) throws JMException {
        Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
        MyExceptionProcesser exceptionProcesser = new MyExceptionProcesser();
         String startUrl = siteUrl+exceptionProcesser.model+"/index.html";
        Spider spider = Spider.create(exceptionProcesser).addUrl(startUrl).thread(5);
        spider.addPipeline(new JeeCmsPiePline(spider));
        SpiderMonitor.instance().register(spider);
        spider.start();
    }
}
